.richTextEditor {
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;

  &:hover {
    border-color: #4096ff;
  }

  &:focus-within {
    border-color: #4096ff;
    box-shadow: 0 0 0 2px rgba(5, 145, 255, 0.1);
  }
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
  align-items: center;

  .toolbarGroup {
    display: flex;
    gap: 4px;
    align-items: center;

    &:not(:last-child)::after {
      content: '';
      width: 1px;
      height: 20px;
      background: #d9d9d9;
      margin-left: 8px;
    }
  }

  .toolbarButton {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    color: #595959;
    font-size: 14px;
    transition: all 0.2s;

    &:hover {
      background: #e6f4ff;
      color: #1677ff;
    }

    &.active {
      background: #1677ff;
      color: #fff;
    }

    &:disabled {
      color: #bfbfbf;
      cursor: not-allowed;
      background: transparent;
    }
  }

  .colorPicker {
    position: relative;
    
    .colorButton {
      position: relative;
      
      &::after {
        content: '';
        position: absolute;
        bottom: 2px;
        left: 50%;
        transform: translateX(-50%);
        width: 16px;
        height: 3px;
        background: currentColor;
        border-radius: 1px;
      }
    }
  }

  .linkInput {
    display: flex;
    gap: 4px;
    align-items: center;
    
    input {
      padding: 4px 8px;
      border: 1px solid #d9d9d9;
      border-radius: 4px;
      font-size: 12px;
      width: 200px;
      
      &:focus {
        outline: none;
        border-color: #4096ff;
      }
    }
    
    button {
      padding: 4px 8px;
      border: 1px solid #d9d9d9;
      border-radius: 4px;
      background: #fff;
      cursor: pointer;
      font-size: 12px;
      
      &:hover {
        border-color: #4096ff;
        color: #4096ff;
      }
    }
  }
}

.editorContent {
  min-height: 300px;
  padding: 16px;
  
  :global {
    .ProseMirror {
      outline: none;
      min-height: 268px;
      line-height: 1.6;
      color: #262626;
      
      p {
        margin: 0 0 12px 0;
        
        &:last-child {
          margin-bottom: 0;
        }
      }
      
      h1, h2, h3, h4, h5, h6 {
        margin: 20px 0 12px 0;
        font-weight: 600;
        line-height: 1.4;
        
        &:first-child {
          margin-top: 0;
        }
      }
      
      h1 { font-size: 28px; }
      h2 { font-size: 24px; }
      h3 { font-size: 20px; }
      h4 { font-size: 16px; }
      h5 { font-size: 14px; }
      h6 { font-size: 12px; }
      
      ul, ol {
        margin: 12px 0;
        padding-left: 24px;
        
        li {
          margin: 4px 0;
        }
      }
      
      blockquote {
        margin: 16px 0;
        padding: 12px 16px;
        border-left: 4px solid #1677ff;
        background: #f6f8fa;
        color: #595959;
        font-style: italic;
      }
      
      code {
        background: #f5f5f5;
        padding: 2px 6px;
        border-radius: 3px;
        font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
        font-size: 0.9em;
        color: #d63384;
      }
      
      pre {
        background: #f5f5f5;
        padding: 12px 16px;
        border-radius: 6px;
        overflow-x: auto;
        margin: 16px 0;
        
        code {
          background: none;
          padding: 0;
          color: inherit;
        }
      }
      
      hr {
        margin: 24px 0;
        border: none;
        border-top: 2px solid #f0f0f0;
      }
      
      a {
        color: #1677ff;
        text-decoration: none;
        
        &:hover {
          text-decoration: underline;
        }
      }
      
      img {
        max-width: 100%;
        height: auto;
        border-radius: 4px;
        margin: 8px 0;
      }
      
      table {
        border-collapse: collapse;
        margin: 16px 0;
        width: 100%;
        
        th, td {
          border: 1px solid #d9d9d9;
          padding: 8px 12px;
          text-align: left;
        }
        
        th {
          background: #fafafa;
          font-weight: 600;
        }
        
        tr:nth-child(even) {
          background: #fafafa;
        }
      }
      
      mark {
        background: #fff2b8;
        padding: 1px 2px;
        border-radius: 2px;
      }
      
      strong {
        font-weight: 600;
      }
      
      em {
        font-style: italic;
      }
      
      u {
        text-decoration: underline;
      }
      
      s {
        text-decoration: line-through;
      }
    }
  }
}